home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-01-10 | 22.6 KB | 816 lines | [TEXT/MPS ] |
- //[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]
- /* Copyright © 1986-1990 Apple Computer, Inc. All rights reserved. */
-
-
- #ifndef __UTabTEView__
- #include <UTabTEView.h>
- #endif
-
- #ifndef __UDocument__
- #include <UDocument.h>
- #endif
-
- #ifndef __UFailure__
- #include <UFailure.h>
- #endif
-
- #ifndef __UMacAppUtilities__
- #include <UMacAppUtilities.h>
- #endif
-
- #ifndef __Dialogs__
- #include <Dialogs.h>
- #endif
-
- #ifndef __UPatch__
- #include <UPatch.h>
- #endif
-
- #ifndef __UMemory__
- #include <UMemory.h>
- #endif
-
- #ifndef __UMacAppGlobals__
- #include <UMacAppGlobals.h>
- #endif
-
- #ifndef __UViewCoords__
- #include <UViewCoords.h>
- #endif
-
- #ifndef __Menus__
- #include <Menus.h>
- #endif
-
- #ifndef __UMenuMgr__
- #include <UMenuMgr.h>
- #endif
-
- #ifndef __Errors__
- #include <Errors.h>
- #endif
-
- #ifndef __ToolUtils__
- #include <ToolUtils.h>
- #endif
-
- #ifndef __Packages__
- #include <Packages.h>
- #endif
-
- #ifndef __Fonts__
- #include <Fonts.h>
- #endif
-
- #ifndef __Script__
- #include <Script.h>
- #endif
-
-
- //$J+*/ // These have storage allocated elsewhere
- extern short HookedCQDProcsPtrOffset; // offset in object to the QDProcs record
- extern short OldTEHooksRecOffset; // offset in object to the OldHooks record
-
- extern TTabTEView* curTabTEView; /* accessed synchronously by the QD
- replacement procs to get context */
- //$J-
-
- short pLastTheLength;
- short pLastTheWidthBefore;
- TTabTEView* pLastSelf;
- short pLastTETxMeas;
- short pLastTheCharOffset;
- short pLastTheLine;
-
- extern pascal void myTEDrawHook(void);
-
- extern pascal void myTEWidthHook(void);
-
- extern pascal void myTEHitTestHook(void);
-
- extern pascal void myTEEOLHook(void);
-
- pascal short CallOriginalTxMeas(short byteCount,
- Ptr textAddr,
- Point& numer,
- Point& denom,
- FontInfo& info,
- ProcPtr actionProc) = { 0x205F, 0x4E90 };
- /* MOVE.L (A7)+,A0
- JSR (A0)
- */
-
- pascal void CallOriginalText(short theLength,
- Ptr theText,
- Point numer,
- Point denom,
- ProcPtr actionProc) = { 0x205F, 0x4E90 };
- /* MOVE.L (A7)+,A0
- JSR (A0)
- */
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEInit
-
- pascal void InitUTabTEView(void)
- {
- if (!gUTEViewInitialized)
- InitUTEView();
-
- if (qTemplateViews)
- {
- // So linker doesn't strip TTabTEView class
- DontDeadStrip(TTabTEView);
- }
- }
-
- // Follows are the bottleneck procs for QuickDraw to perform tabs
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
- //$Push*/
- #if qTrace
- /*$D+*/
- #endif
- // we don't really need these guys traced!
-
- pascal short myTxMeas(short theLength,
- Ptr theText,
- Point& numer,
- Point& denom,
- FontInfo& info)
- {
- if (curTabTEView != NULL)
- return curTabTEView->TETxMeas(theLength, theText, numer, denom, info);
- else
- #if false
- return CallOriginalTxMeas(theLength, theText, numer, denom, info,
- curTabTEView->fOldCQDProcs.txMeasProc)
- #endif
- DebugStr("whoops!");
- }
- //$Pop
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
- //$Push*/
- #if qTrace
- /*$D+*/
- #endif
- // we don't really need these guys traced!
-
- pascal void myDrawText(short theLength,
- Ptr theText,
- Point numer,
- Point denom)
- {
- if (curTabTEView != NULL)
- curTabTEView->TEDrawText(theLength, theText, numer, denom);
- else
- #if false
- CallOriginalText(theLength, theText, numer, denom, curTabTEView->fOldCQDProcs.textProc);
- #endif
- DebugStr("whoops!");
- }
- //$Pop
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
- //$Push*/
- #if qTrace
- /*$D+*/
- #endif
- // we don't really need these guys traced!
-
- pascal void TTabTEView::TEDrawText(short theLength,
- Ptr theText,
- Point numer,
- Point denom)
- {
- short margin;
- Point currentPoint;
- short beginChar;
-
- TERec theTERec = **fHTE;
- {
- beginChar = 0;
- margin = theTERec.destRect.left;
- for (short i = 0; i <= theLength - 1; i++)
- {
- switch ( (unsigned char) *(theText + i))
- {
- case chTab:
- CallOriginalText(i - beginChar, (Ptr) (theText + beginChar), numer, denom,
- (ProcPtr) fOldCQDProcs.textProc);
- beginChar = i + 1;
-
- GetPen(currentPoint);
-
- if (fShowInvisibles)
- DrawChar(kVisibleTAB);
-
- currentPoint.h = currentPoint.h - margin + fTabSize;
- currentPoint.h = (currentPoint.h / fTabSize) * fTabSize + margin + 1;
-
- MoveTo(currentPoint.h, currentPoint.v);
- break;
- case chReturn:
- if (fShowInvisibles)
- {
- CallOriginalText(i - beginChar, (Ptr) (theText + beginChar), numer, denom,
- (ProcPtr) fOldCQDProcs.textProc);
- beginChar = i + 1;
-
- DrawChar(kVisibleCR);
- }
- break;
- case chSpace:
- if (fShowInvisibles)
- {
- CallOriginalText(i - beginChar, (Ptr)(theText + beginChar), numer, denom,
- (ProcPtr) fOldCQDProcs.textProc);
- beginChar = i + 1;
-
- DrawChar(kVisibleSpace);
- }
- break;
- }
- }
- }
-
- CallOriginalText(theLength - beginChar, (Ptr) ( theText + beginChar), numer, denom,
- (ProcPtr) fOldCQDProcs.textProc);
- }
- //$Pop
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
- //$Push*/
- #if qTrace
- /*$D+*/
- #endif
- // we don't really need these guys traced!
-
- pascal short TTabTEView::TETextLength(Ptr theText,
- short theLength,
- short theWidthBefore,
- Point& numer,
- Point& denom,
- FontInfo& info)
- {
- short beginChar;
- short theWidth;
- QDByte aByte;
-
- theWidth = 0;
- beginChar = 0;
- for (short i = 0 ; i <= theLength - 1; i++)
- {
- switch ( (unsigned char) *(theText + i))
- {
- case chTab:
- theWidth = theWidth + CallOriginalTxMeas(i - beginChar, (Ptr)(theText +
- beginChar), numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc);
- beginChar = i + 1;
- theWidth = ((theWidth + fTabSize + theWidthBefore) / fTabSize) *
- fTabSize - theWidthBefore;
- break;
- case chSpace:
- if (fShowInvisibles)
- {
- theWidth = theWidth + CallOriginalTxMeas(i - beginChar,(Ptr)(theText +
- beginChar), numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc);
- beginChar = i + 1;
- aByte = QDByte(kVisibleSpace);
- theWidth = theWidth + CallOriginalTxMeas(1, &aByte, numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc);
- }
- break;
- case chReturn:
- if (fShowInvisibles)
- {
- theWidth = theWidth + CallOriginalTxMeas(i - beginChar, (Ptr)(theText +
- beginChar), numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc);
- beginChar = i + 1;
- aByte = QDByte(kVisibleCR);
- theWidth = theWidth + CallOriginalTxMeas(1, &aByte, numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc);
- }
- break;
- }
- }
-
- return (theWidth + CallOriginalTxMeas(theLength - beginChar, (Ptr)(theText +
- beginChar), numer, denom, info,
- (ProcPtr) fOldCQDProcs.txMeasProc) );
- }
- //$Pop
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
- //$Push*/
- #if qTrace
- /*$D+*/
- #endif
- // we don't really need these guys traced!
-
- pascal short TTabTEView::TETxMeas(short theLength,
- Ptr theText,
- Point& numer,
- Point& denom,
- FontInfo& info)
- {
- short TheCharOffset;
- short theline;
- short theWidthBefore;
-
-
- /*
- Find which line in the TE the text pointed to by theText starts on and measure the
- distance between the start of the line and the position in theline pointed to by theText.
- This whole scheme depends on textedit passing us a pointer to the actual hText->
- */
-
- TERec& theTERec = **fHTE;
- {
- // find out what line we're currently on
- //!!! Note cast
- TheCharOffset = (short) (StripLong(theText) - StripLong(*theTERec.hText)); /* hText could have been
- a resource */
-
- if ((this == pLastSelf) && (TheCharOffset == pLastTheCharOffset))
- {
- theline = pLastTheLine;
- }
- else /* Scan backward thru the line starts array
- for a linestart less than TheCharOffset */
- {
- for ( theline = (short) Max(theTERec.nLines - 1, 0); theline >= 0 ; theline-- ) //!!! Note long->short cast
- if (theTERec.lineStarts[theline] <= TheCharOffset)
- break;
- }
-
- // if the line is the same we may be able to save some calculation by caching
-
- #if FALSE
- //### !NOW
- if ((this == pLastSelf) && (theline == pLastTheLine))
- {
- if (TheCharOffset < pLastTheCharOffset)) /* starts sooner on line. saved
- theWidthBefore info is useless */
- {
- if ((lineStarts[theline] == TheCharOffset) || (lineStarts[theline] < 0)) /* the
- beginning of a line or end of text */
- theWidthBefore = 0;
- else
- theWidthBefore = TETextLength((Ptr)((*hText) + lineStarts[theline]),
- TheCharOffset - lineStarts[theline], 0, numer,
- denom, info);
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- }
- else if (TheCharOffset > pLastTheCharOffset)) /* starts later on line. Attempt to
- re-use some width before info */
- {
- if (TheCharOffset < (pLastTheCharOffset + pLastTheLength))) /* starts sooner than
- end of last run pLastTETxMeas is useless */
- {
- theWidthBefore = TETextLength(Ptr((*hText) + pLastTheCharOffset),
- TheCharOffset - pLastTheCharOffset,
- theWidthBefore, numer, denom, info);
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- }
- else if (TheCharOffset > (pLastTheCharOffset + pLastTheLength)))
- {
- theWidthBefore = pLastTheWidthBefore + pLastTETxMeas;
- theWidthBefore = TETextLength(Ptr((*hText) + pLastTheCharOffset +
- pLastTheLength), TheCharOffset -
- (pLastTheCharOffset + pLastTheLength),
- theWidthBefore, numer, denom, info);
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- }
- else // must be equal
- {
- theWidthBefore = pLastTheWidthBefore + pLastTETxMeas;
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info)
- }
- }
- else // must be equal starting position
- {
- if (theLength < pLastTheLength))
- {
- if ((lineStarts[theline] == TheCharOffset) || (lineStarts[theline] < 0)) /* the
- beginning of a line or end of text */
- theWidthBefore = 0
- else
- theWidthBefore = TETextLength((Ptr)((*hText) + lineStarts[theline]),
- TheCharOffset - lineStarts[theline], 0,
- numer, denom, info);
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom,
- info);
- } else if (theLength > pLastTheLength))
- {
- pLastTETxMeas = pLastTETxMeas + TETextLength((Ptr)(theText +
- pLastTheLength), theLength -
- pLastTheLength,
- pLastTheWidthBefore +
- pLastTETxMeas, numer, denom, info)
- }
- else // must be equal
- {
- pLastTETxMeas = pLastTETxMeas;
- }
-
- }
- }
- else // line not the same. no caching available
- #endif
- {
- if ((theTERec.lineStarts[theline] == TheCharOffset) || (theTERec.lineStarts[theline] < 0)) /* the
- beginning of a line or end of text */
- theWidthBefore = 0;
- else
- theWidthBefore = TETextLength((Ptr)((*theTERec.hText) + theTERec.lineStarts[theline]),
- TheCharOffset - theTERec.lineStarts[theline], 0, numer,
- denom, info);
- pLastTETxMeas = TETextLength(theText, theLength, theWidthBefore, numer, denom, info);
- }
- }
-
- pLastTheWidthBefore = theWidthBefore;
- pLastTheCharOffset = TheCharOffset;
- pLastTheLine = theline;
- pLastTheLength = theLength;
- pLastSelf = this;
- return pLastTETxMeas;
- }
- //$Pop
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
-
- pascal void TTabTEView::WithHookedGrafProcsDo (pascal void (*whatToDo) (void* staticLink), void* staticLink)
- {
- QDProcsPtr oldGrafProcs; /* the grafprocs pointer found in the TE's
- grafport */
- TTabTEView* oldCurTEView; // the saved setting of the curTEView
-
- /* Make this available to the hooked grafprocs that will be invoked later
- save the old curTabTEView first */
- oldCurTEView = curTabTEView;
- curTabTEView = this;
-
- // save its old grafprocs pointer
- oldGrafProcs = (**fHTE).inPort->grafProcs;
- (**fHTE).inPort->grafProcs = QDProcsPtr(fHookedCQDProcsPtr);
-
- // Do what we were called for
- whatToDo(staticLink);
-
- // restore the old curTabTEView, grafprocs and that showed we were hooked in
-
- curTabTEView = oldCurTEView;
- (**fHTE).inPort->grafProcs = oldGrafProcs;
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
-
- typedef pascal void (*WhatToDoType) (void* staticLink);
- class CWhatToDo
- {
- TTabTEView* fThis;
- VPoint& fTheMouse;
- TDeviceEvent*& fEvent;
- Point& fHysteresis;
- public:
- // Constructor
- CWhatToDo(TTabTEView* theThis,
- VPoint& theMouse,
- TDeviceEvent* event,
- Point& hysteresis ):
- fThis(theThis), fTheMouse(theMouse), fEvent(event), fHysteresis(hysteresis) {};
-
- pascal void WhatToDo(void);
- };
-
- #pragma segment TERes
- pascal void CWhatToDo::WhatToDo(void)
- {
- fThis->TTEView::DoMouseCommand(fTheMouse, fEvent, fHysteresis); // INHERITED
- };
-
- #pragma segment TERes
- pascal void TTabTEView::DoMouseCommand(VPoint& theMouse,
- TDeviceEvent* event,
- Point& hysteresis) // override
-
-
- {
- CWhatToDo aCWhatToDo(this,theMouse,event,hysteresis);
- // lousy TE (6.0) doesn't always respect TECustomHook!
- WithHookedGrafProcsDo( (WhatToDoType) &CWhatToDo::WhatToDo,&aCWhatToDo);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
-
- pascal void TTabTEView::DoSetupMenus(void) // override
- {
- inherited::DoSetupMenus();
-
- Enable(cIncTabs, TRUE);
- Enable(cDecTabs, TRUE);
- EnableCheck(cShowInvs, TRUE, fShowInvisibles); /**/
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TESelCommand
-
- pascal void TTabTEView::DoMenuCommand(CmdNumber aCmdNumber) // override
- {
- switch (aCmdNumber)
- {
- case cIncTabs:
- TSetTabCommand* aSetTabCmd1 = new TSetTabCommand;
-
- aSetTabCmd1->ISetTabCommand(this, aCmdNumber, fTabSize + 1);
- this->PostCommand(aSetTabCmd1);
- break;
- case cDecTabs:
- TSetTabCommand* aSetTabCmd2 = new TSetTabCommand;
-
- aSetTabCmd2->ISetTabCommand(this, aCmdNumber, fTabSize - 1);
- this->PostCommand(aSetTabCmd2);
- break;
- case cShowInvs:
- TShowInvsCommand* aShowInvsCmd = new TShowInvsCommand;
-
- aShowInvsCmd->IShowInvsCommand(this, aCmdNumber, fShowInvisibles);
- this->PostCommand(aShowInvsCmd);
- break;
- default:
- inherited::DoMenuCommand(aCmdNumber);
- }
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEOpen
-
- pascal void TTabTEView::IRes(TDocument* itsDocument,
- TView* itsSuperView,
- Ptr& itsParams) // override
- {
- ProcPtr aProcPtr;
-
-
- fHookedCQDProcsPtr = NULL;
-
- inherited::IRes(itsDocument, itsSuperView, itsParams);
-
- fHookedCQDProcsPtr = CQDProcsPtr(NewPermPtr(sizeof(CQDProcs)));
- fTabSize = kDefaultTabSize;
- fShowInvisibles = FALSE;
- fControlChars = __SetBit__(fControlChars) | __SetBit__(chTab); // fControlChars = fControlChars + [chTab]; // tell TTE to accept tabs
-
- if (fStyleType) // only for style right now… sorry!
- {
- if (fHTE != NULL)
- {
- // Storing this in the refcon should be in MacApp
- (*GetStylHandle(fHTE))->teRefCon = (long)(this);
-
- // let the ASM code know the offset of some of our structures
- HookedCQDProcsPtrOffset = (short) (StripLong(&fHookedCQDProcsPtr) - StripLong((*(Handle)(this)))); //!!! Note long->short cast
- OldTEHooksRecOffset = (short) (StripLong(&fOldTEHooksRec) - StripLong((*(Handle)(this)))); //!!! Note long->short cast
-
- // set up custom hooks into my TE to handle tabs
- aProcPtr = (ProcPtr) &myTEDrawHook;
- TECustomHook(intDrawHook, aProcPtr, fHTE);
- fOldTEHooksRec.DrawHook = aProcPtr;
-
- aProcPtr = (ProcPtr) &myTEWidthHook;
- TECustomHook(intWidthHook, aProcPtr, fHTE);
- fOldTEHooksRec.WidthHook = aProcPtr;
-
- aProcPtr = (ProcPtr) &myTEHitTestHook;
- TECustomHook(intHitTestHook, aProcPtr, fHTE);
- fOldTEHooksRec.HitTestHook = aProcPtr;
-
- }
- }
- this->BeInPort(GetGrafPort());
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TENonRes
-
- pascal void TTabTEView::BeInPort(GrafPtr itsPort) // override
- // save a copy of the currently effective GrafProcs and create a new version of the hooked procs
- {
- CQDProcs theCProcs;
- QDProcs theProcs;
- QDProcsPtr aQDProcsPtr;
- CGrafPtr itsCPort;
-
- inherited::BeInPort(itsPort);
-
- if ((fHTE != NULL) && (fHookedCQDProcsPtr != NULL))
- {
- if (IsColorPort(itsPort))
- {
- itsCPort = (CGrafPtr) itsPort;
- if (itsCPort->grafProcs == NULL)
- {
- SetStdCProcs(theCProcs);
- fOldCQDProcs = theCProcs;
- }
- else
- fOldCQDProcs = *(CQDProcsPtr)(itsCPort->grafProcs);
- }
- else
- {
- if (itsPort->grafProcs == NULL)
- {
- SetStdProcs(theProcs);
- aQDProcsPtr = (QDProcsPtr)(&fOldCQDProcs);
- (*aQDProcsPtr) = theProcs;
- }
- else
- {
- aQDProcsPtr = (QDProcsPtr)(&fOldCQDProcs);
- (*aQDProcsPtr) = *(itsPort->grafProcs);
- }
- }
-
- // stuff my replacements into the hooked grafprocs
- (*fHookedCQDProcsPtr) = fOldCQDProcs;
- fHookedCQDProcsPtr->textProc = (Ptr) &myDrawText;
- fHookedCQDProcsPtr->txMeasProc = (Ptr) &myTxMeas;
- }
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEOpen
-
- pascal void TTabTEView::SetTabSize(short newSize, Boolean redraw)
- {
- fTabSize = newSize;
- fSpecsChanged = TRUE;
- SynchView(FALSE);
- if (redraw)
- this->ForceRedraw();
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TERes
-
- pascal void TTabTEView::ShowInvisibles(Boolean showEm, Boolean redraw)
- {
- fShowInvisibles = showEm;
- if (redraw)
- this->ForceRedraw();
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEFields
-
- pascal void TTabTEView::Fields(TObject* obj) // override
- {
- obj->DoToField("TTabTEView", (Ptr)NULL, bClass);
- obj->DoToField("fTabSize", (Ptr)&fTabSize, bInteger);
- obj->DoToField("fShowInvisibles", (Ptr)&fShowInvisibles, bBoolean);
- if (IsColorPort(GetGrafPort()))
- {
- obj->DoToField("fOldCQDProcs", (Ptr)&fOldCQDProcs, bCQDProcs);
- obj->DoToField("(*fHookedCQDProcsPtr)", (Ptr) &(*fHookedCQDProcsPtr), bCQDProcs);
- }
- else
- {
- obj->DoToField("fOldCQDProcs", (Ptr)&fOldCQDProcs, bQDProcs);
- obj->DoToField("(*fHookedCQDProcsPtr)", (Ptr) &(*fHookedCQDProcsPtr), bQDProcs);
- }
- inherited::Fields(obj);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TESelCommand
-
- pascal void TSetTabCommand::ISetTabCommand(TView* itsView,
- CmdNumber itsCmdNumber,
- short tabSetting)
- {
- this->ICommand(itsCmdNumber, itsView->fDocument, itsView);
- if (fView->IsMemberClass(GetClassIDFromName("TTabTEView")))
- fOldTabSetting = ((TTabTEView*) itsView)->fTabSize;
- else
- fOldTabSetting = 0;
- fNewTabSetting = tabSetting;
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TSetTabCommand::DoIt(void) // override
- // sets new tabs, then calls ForceRedraw
- {
- if (fView->Focus()); //??? What if Focus fails
- if (fView->IsMemberClass(GetClassIDFromName("TTabTEView")))
- ((TTabTEView*) fView)->SetTabSize(fNewTabSetting, kRedraw);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TSetTabCommand::RedoIt(void) // override
- // calls DoIt
- {
- this->DoIt();
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TSetTabCommand::UndoIt(void) // override
- // restores previous tab setting
- {
- if (fView->Focus()); //??? What if Focus fails
- if (fView->IsMemberClass(GetClassIDFromName("TTabTEView")))
- ((TTabTEView*) fView)->SetTabSize(fOldTabSetting, kRedraw);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEFields
-
- // Debugging
-
- pascal void TSetTabCommand::Fields(TObject* obj) // override
- {
- obj->DoToField("TSetTabCommand", (Ptr)NULL, bClass);
- obj->DoToField("fOldTabSetting", (Ptr)&fOldTabSetting, bInteger);
- obj->DoToField("fNewTabSetting", (Ptr)&fNewTabSetting, bInteger);
-
- inherited::Fields(obj);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TESelCommand
-
- pascal void TShowInvsCommand::IShowInvsCommand(TView* itsView,
- CmdNumber itsCmdNumber,
- Boolean invsWereShown)
- {
- ICommand(itsCmdNumber, itsView->fDocument, itsView);
- fInvsWereShown = invsWereShown;
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TShowInvsCommand::DoIt(void) // override
- // sets new tabs, then calls ForceRedraw
- {
- if (fView->Focus()); //??? What if Focus fails
- if (fView->IsMemberClass(GetClassIDFromName("TTabTEView")))
- ((TTabTEView*) fView)->ShowInvisibles(!fInvsWereShown, kRedraw);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TShowInvsCommand::RedoIt(void) // override
- // calls DoIt
- {
- this->DoIt();
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEDoCommand
-
- pascal void TShowInvsCommand::UndoIt(void) // override
- // restores previous tab setting
- {
- if (fView->Focus()); //??? What if Focus fails
- if (fView->IsMemberClass(GetClassIDFromName("TTabTEView")))
- ((TTabTEView*) fView)->ShowInvisibles(fInvsWereShown, kRedraw);
- }
-
- //--------------------------------------------------------------------------------------------------
- #pragma segment TEFields
-
- // Debugging
-
- pascal void TShowInvsCommand::Fields(TObject* obj) // override
- {
- obj->DoToField("TShowInvsCommand", (Ptr)NULL, bClass);
- obj->DoToField("fInvsWereShown", (Ptr)&fInvsWereShown, bBoolean);
-
- inherited::Fields(obj);
- }
-